import {defineStore} from 'pinia'
import {IUserResultState,IUserInfo} from '../types'
const useUsersStore=defineStore('users',{
    state:():IUserResultState=>{
        return{
           userInfo:null,
           token:''
        }
    },
    actions:{
        setLoginResult(userInfo:IUserInfo,token:string){
            console.log('********进入pinia状态机设置********');
            console.log('userInfo',userInfo);
            console.log('token',token);
            this.userInfo=userInfo
            this.token=token   
        }
    },
    persist:{
        enabled:true,
        strategies:[
            {
                storage:localStorage
            }
        ]
    }
})
export default useUsersStore